package com.xxmw.transaction.service.app;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xxmw.transaction.common.entity.P;
import com.xxmw.transaction.model.app.Symbol;

import java.util.List;
import java.util.Set;

/**
 *
 * @since  2020/4/10 09:39
 * @author luowenliang
 */
public interface SymbolService extends IService<Symbol> {

    String SYMBOL_DAY_OPEN_PRICE = "transaction:symbol:day:open:price";

    /**
     * @param pageNum
     * @param pageSize
     * @param name
     * @return
     */
    P<Symbol> pageList(int pageNum, int pageSize, String name);

    /**
     * 根据报价币种获取
     * @return
     */
    List<Symbol> findByQuoteCurrency (String currency);

    /**
     * 获取用户api
     * @param name
     * @return
     */
    Symbol getBuyName(String name);

    /**
     * 是否含有该交易对 btceth 与 ethbtc视为相同
     * @return
     */
    boolean hasSymbol (String baseCurrency, String quoteCurrency);

    /**
     * 获取所有报价币种
     * @return
     */
    Set<String> quoteCurrency ();

    Set<Symbol> listByBourse(Integer bourseId);

    /**
     * 缓存交易对当天0点价格
     */
    void cacheSymbolDayOpenPrice ();

    /**
     * 推送交易对信息给App端
     * @param symbol 交易对
     * @param close 最新价
     */
    void pushSymbolInfo (String symbol, String close);
}
